<script setup lang="tsx">
import { reactive, onMounted } from 'vue'
import { getorgAPI } from '@/api/search/index'
import { HttpCodeEnum } from '@packages/share/enums'
const props = defineProps({
  id: { type: String, required: true }
})

const descriptions = reactive({
  columns: [
    { label: '机构名称', prop: 'name' },
    { label: '机构地址', prop: 'address' },
    { label: '邮箱', prop: 'email' },
    { label: '描述', prop: 'desc' }
  ],
  data: {}
})

const getInfo = (id: string) => {
  getorgAPI(id).then((res: AxiosResponse) => {
    const { data, code } = res.data
    if (code === HttpCodeEnum.SUCCESS) {
      descriptions.data = data
    }
  })
}
onMounted(() => {
  getInfo(props.id)
})
</script>
<template>
  <jmp-descriptions
    :column="2"
    v-model:columns="descriptions.columns"
    v-model:data="descriptions.data"
  ></jmp-descriptions>
</template>
